﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using Microsoft.EntityFrameworkCore;
using Dal.Iterfease;

namespace Dal.infDal
{
    public class UserDal: IUserDal
    {
        private readonly AppDbContext _appDbContext;

        public UserDal(AppDbContext appDbContext)
        {
            _appDbContext = appDbContext;
        }

        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="us"></param>
        /// <returns></returns>
        public int AddUser(userInfo us)
        {
            _appDbContext.userInfos.Add(us);
            return _appDbContext.SaveChanges();
        }

        //登录
        public userInfo Lodeuser(string Uname, int Upwd)
        {
         var a= _appDbContext.userInfos.FirstOrDefault(u => u.Uname == Uname && u.Upwd == Upwd);
            return a;
        }

            
    }
}
